| Conditions | 1 |
| Total Lines | 39 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import {PollState} from './helpers/interfaces'; |
||
| 3 | |||
| 4 | /** |
||
| 5 | * Build the add option form. |
||
| 6 | * |
||
| 7 | * @param {object} state - the current message state |
||
| 8 | * @returns {object} card |
||
| 9 | */ |
||
| 10 | export function buildAddOptionForm(state: PollState): chatV1.Schema$GoogleAppsCardV1Card { |
||
| 11 | return { |
||
| 12 | 'header': { |
||
| 13 | 'title': 'Add a new option/choice', |
||
| 14 | 'subtitle': 'Q:' + state.topic, |
||
| 15 | }, |
||
| 16 | 'sections': [ |
||
| 17 | { |
||
| 18 | 'widgets': [ |
||
| 19 | { |
||
| 20 | 'textInput': { |
||
| 21 | 'label': 'Option Name', |
||
| 22 | 'type': 'SINGLE_LINE', |
||
| 23 | 'name': 'value', |
||
| 24 | 'hintText': '', |
||
| 25 | 'value': '', |
||
| 26 | }, |
||
| 27 | 'horizontalAlignment': 'START', |
||
| 28 | }, |
||
| 29 | ], |
||
| 30 | }, |
||
| 31 | ], |
||
| 32 | 'fixedFooter': { |
||
| 33 | 'primaryButton': { |
||
| 34 | 'text': 'Add option', |
||
| 35 | 'onClick': { |
||
| 36 | 'action': { |
||
| 37 | 'function': 'add_option', |
||
| 38 | 'parameters': [ |
||
| 39 | { |
||
| 40 | key: 'state', |
||
| 41 | value: JSON.stringify(state), |
||
| 42 | }], |
||
| 49 |